package com.pms.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import com.pms.dao.DeptMapper;
import com.pms.pojo.Department;
import com.pms.pojo.DeptTransfer;
import com.pms.pojo.DeptTurn;
import com.pms.pojo.Employees;
import com.pms.pojo.FindRequire;
import com.pms.pojo.Require;

@Repository("deptDao")
public class DeptDao implements DeptMapper {

	private  SqlSessionTemplate  sqlSessionTemplete;

	public void setSqlSessionTemplete(SqlSessionTemplate sqlSessionTemplete) {
		this.sqlSessionTemplete = sqlSessionTemplete;
	}
	@Override
	public List<Employees> getEmployees() {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.DeptMapper.getEmployees";
		
		return this.sqlSessionTemplete.selectList(statement);
		
	}
	@Override
	public List<Department> getDepartment() {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.DeptMapper.getDepartment";
		
		return this.sqlSessionTemplete.selectList(statement);
		
	}
	@Override
	public List<Employees> getRequireEmployees(Require require) {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.DeptMapper.getRequireEmployees";
			
		return this.sqlSessionTemplete.selectList(statement, require);
		
	}
	@Override
	public Employees getEmployeeById(Integer emp_id) {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.DeptMapper.getEmployeeById";
		
		return this.sqlSessionTemplete.selectOne(statement, emp_id);
	}
	@Override
	public void updateEmployee(DeptTransfer deptTransfer) {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.DeptMapper.updateEmployee";
		this.sqlSessionTemplete.update(statement, deptTransfer);
	}
	@Override
	public Department getDept(Integer dt_dept_a) {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.DeptMapper.getDept";
		return this.sqlSessionTemplete.selectOne(statement, dt_dept_a);
		 
	}
	@Override
	public void addDeptTransfer(DeptTransfer deptTransfer) {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.DeptMapper.addDeptTransfer";
		this.sqlSessionTemplete.insert(statement, deptTransfer);
	}
	@Override
	public List<DeptTurn> getDeptTranfer() {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.DeptMapper.getDeptTranfer";
		return this.sqlSessionTemplete.selectList(statement);
	}
	@Override
	public List<DeptTurn> getByRequire(FindRequire findrequire) {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.DeptMapper.getByRequire";
		return this.sqlSessionTemplete.selectList(statement, findrequire);
	}

	
	
}
